home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 November: Tool Chest / Dev.CD Nov 98 TC.toast / Sample Code / QuickTime / JPEG Sample / Headers / Proto.h < prev   
Encoding:
C/C++ Source or Header  |  1997-03-05  |  6.2 KB  |  176 lines  |  [TEXT/CWIE]

  1. /*************************************************************************************
  2. #
  3. #        Proto.h
  4. #
  5. #        This file contains the prototypes for the apps procs and funcs
  6. #
  7. #        Author(s):     Michael Marinkovich & Guillermo Ortiz
  8. #                    marink@apple.com
  9. #
  10. #        Modification History: 
  11. #
  12. #            4/3/96        MWM     Initial coding                     
  13. #
  14. #        Copyright © 1992-96 Apple Computer, Inc., All Rights Reserved
  15. #
  16. #
  17. #        You may incorporate this sample code into your applications without
  18. #        restriction, though the sample code has been provided "AS IS" and the
  19. #        responsibility for its operation is 100% yours.  However, what you are
  20. #        not permitted to do is to redistribute the source as "DSC Sample Code"
  21. #        after having made changes. If you're going to re-distribute the source,
  22. #        we require that you make it clear in the source that the code was
  23. #        descended from Apple Sample Code, but that you've made changes.
  24. #
  25. *************************************************************************************/
  26.  
  27. #include <Displays.h>
  28. #include <ImageCompression.h>
  29.  
  30.  
  31. //----------------------------------------------------------------------
  32. //
  33. //    JPEG
  34. //
  35. //----------------------------------------------------------------------
  36.  
  37. OSErr            ReadJPEG(FSSpec spec, CGrafPtr *newWorld);
  38. OSErr            ConvertJPEG(Handle image, CGrafPtr *newWorld);
  39. OSErr             ReadJPEGHeader(short refNum, ImageDescriptionHandle desc, Rect *bounds);
  40. UInt8            FindNextMarker(long refNum);
  41. OSErr             HandleAPPOMarker(UInt8 marker, long refNum, ImageDescriptionHandle desc, Boolean *readingExtension);
  42. OSErr             HandleSOFMarker(long refNum, ImageDescriptionHandle desc, Boolean readingExtension);
  43. void             HandleSOSMarker(long refNum);
  44. UInt8              ReadByte(short refNum);
  45. UInt16             ReadWord(short refNum);
  46. void             SkipLength(long refNum);
  47. OSErr             NewJPEGWorld(GWorldPtr *theWorld, short depth, Rect theRect);
  48. OSErr             SaveJPEG(WindowRef window);
  49. pascal OSErr     DataUnloadProc(Ptr data, long bytesNeeded, long refCon);
  50. pascal OSErr     DataLoadingProc(Ptr *data, long bytesNeeded, long refCon);
  51.  
  52.  
  53. //----------------------------------------------------------------------
  54. //
  55. //    Aevt
  56. //
  57. //----------------------------------------------------------------------
  58.  
  59. OSErr             AEInit(void);
  60. void            AEDispose(void);
  61. pascal OSErr    DoAEOpenApp(AppleEvent *event, AppleEvent reply, long refCon);
  62. pascal OSErr    DoAEQuitApp(AppleEvent *event, AppleEvent reply, long refCon);
  63. pascal OSErr    DoAEOpenDoc(AppleEvent *event, AppleEvent reply, long refCon);
  64. pascal OSErr    DoAEPrintDoc(AppleEvent *event, AppleEvent reply, long refCon);
  65. OSErr             GotAEParams(AppleEvent *appleEvent);
  66.  
  67.  
  68. //----------------------------------------------------------------------
  69. //
  70. //    Initialize
  71. //
  72. //----------------------------------------------------------------------
  73.  
  74. OSErr            Initialize(void);
  75. void            ToolBoxInit(void);
  76. void             CheckEnvironment(void);
  77. OSErr             InitApp(void);
  78. void             MenuSetup(void);
  79.  
  80.  
  81. //----------------------------------------------------------------------
  82. //
  83. //    Main
  84. //
  85. //----------------------------------------------------------------------
  86.  
  87.  
  88. void             HandleError(short errNo,Boolean fatal);
  89. void             HandleAlert(short alertID);
  90.  
  91.  
  92. //----------------------------------------------------------------------
  93. //
  94. //    Events
  95. //
  96. //----------------------------------------------------------------------
  97.  
  98. void            EventLoop(void);
  99. short             MyGetSleep(void);
  100. void             CustomWindowEvent(short eventType,WindowRef window,void *refCon);
  101. void             DoEvent(EventRecord *event);
  102. void             DoIdle(WindowRef window, void *refCon);
  103. void             HandleMouseDown( EventRecord *event );
  104. void             HandleMenuChoice( WindowRef window, void *refCon );
  105. void            HandleContentClick( WindowRef window, void *refCon );
  106. void             HandleZoomClick( WindowRef window, void *refCon );
  107. void             HandleGrow(WindowRef window, void *refCon);
  108. void             UpdateWindow(WindowRef window);
  109. void             DoActivate(WindowRef window, void *refCon);
  110.  
  111.  
  112. //----------------------------------------------------------------------
  113. //
  114. //    Windows
  115. //
  116. //----------------------------------------------------------------------
  117.  
  118. WindowPtr         CreateWindow(short resID, void *wStorage, Rect *bounds, Str255 title,
  119.                             Boolean visible, short procID,short kind, WindowRef behind,
  120.                             Boolean goAwayFlag,long refCon);
  121. OSErr             RemoveWindow(WindowRef window);
  122. void             NewWindowTitle(WindowRef window, Str255 str);
  123. OSErr             InitWindowProcs(WindowRef window, short windKind);
  124. GWorldPtr        PictToWorld(PicHandle pict, OSErr *rtnErr);
  125. void            DrawWindow( WindowRef window, void *refCon );
  126. void             DrawAboutWindow( WindowRef window, void *refCon );
  127. void             DoResizeWindow (WindowRef window);
  128. short             GetWindKind(WindowRef window);
  129. Boolean            GetIsAppWindow(WindowRef window);
  130. Boolean         GetIsAboutWindow( WindowRef window );
  131.  
  132.  
  133. //----------------------------------------------------------------------
  134. //
  135. //    Displays
  136. //
  137. //----------------------------------------------------------------------
  138.  
  139. OSErr             InstallAEDMNotification(void);
  140. pascal OSErr     WorldChangedProc(AppleEvent event,AppleEvent reply,long refCon);
  141. OSErr             HandleNotification(AppleEvent *event);
  142. OSErr             HandleDeviceChange(DisplayIDType displayID, Rect *newRect);
  143. Boolean         OutOfBoundsRect(Rect windRect, Rect screenRect);
  144. void             MoveInbounds(WindowRef window, GDHandle gd, Rect screenRect);
  145. void            ResizeInbounds(WindowRef window, GDHandle gd, Rect screenRect);
  146. GDHandle         GetGreatestDevice(WindowRef window);
  147. void             ResetStdState(WindowRef window);
  148. short             GetWTitleHeight(WindowRef window);
  149.  
  150.  
  151. //----------------------------------------------------------------------
  152. //
  153. //    Scrolls
  154. //
  155. //----------------------------------------------------------------------
  156.  
  157. void             InstallScrollBars(WindowRef window, DocHnd doc);
  158. void             AdjustScrollValues(WindowRef window);
  159. void             AdjustScrollbars(WindowRef window, Boolean resize);
  160. pascal void     ScrollActionProc(ControlRef control, short part);
  161. void            ScrollPict(short hAmount,short vAmount,WindowRef window);
  162. void             MyScrollPicture(WindowRef window, short hs, short vs);
  163. void             GetContRect(WindowRef window,Rect *contRect);
  164.  
  165.  
  166. //----------------------------------------------------------------------
  167. //
  168. //    Utils
  169. //
  170. //----------------------------------------------------------------------
  171.  
  172. void            DoOpenNew(void);    
  173. PicHandle         ReadFile(FSSpec spec);
  174. void            ZeroRect(Rect *r);
  175. void             pstrcpy(StringPtr dst, StringPtr src);
  176. void             pstrcat(StringPtr dst, StringPtr src);